<template>
  <van-grid square border>
    <van-grid-item v-for="(value, index) in gridImages" :key="index" :icon="'http://127.0.0.1:8089' + value.img_url"
      :text="value.img_name" />
  </van-grid>
</template>

<script>
  import {
    mapState,
    mapMutations
  } from 'vuex'
  export default {
    data() {
      return {}
    },
    mounted() {
      this.getGridInfo()
    },
    methods: {
      ...mapMutations(['SET_GRID_IMAGES']),
      async getGridInfo() {
        this.$api.homeData.gridInfo().then(({
          data
        }) => {
          // this.list = data
          this.SET_GRID_IMAGES(data)
        })
      }
    },
    computed: {
      ...mapState(['gridImages'])
    }
  }
</script>

<style scoped>
  .van-grid {
    margin: 0.5rem;
  }
</style>
